#!/usr/bin/env node

const fs=require('fs'),
      err = console.error,
      src = process.argv[2];
/*
      uid = Number(process.argv[3]),
      gid = Number(process.argv[4]);

//查看uid和gid:id root

if(process.argv.length !== 5) {
  err('命令行参数不正确！');
}

try{
  fs.chownSync(src,uid,gid);
} catch(e) {
  err(e.message);
}
*/
//完善

const id=process.argv[3];
if(process.argv.length!==4){
  err('命令行参数不正确！');
}
let uid=id.split(':')[0],
    gid=id.split(':')[1];

try{
  fs.chownSync(src, Number(uid), Number(gid));
} catch(e) {
  err(e.message);
}

